home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / LNSEFCTS.ZIP / LNSEFCTS.INC < prev    next >
Encoding:
Text File  |  1997-07-18  |  47.5 KB  |  818 lines

  1. // *******************************************************
  2. // LENS EFFECTS INCLUDE FILE FOR PERSISTENCE OF VISION 3.x
  3. // *******************************************************
  4. //
  5. // Created by Chris Colefax, 18 July 1997
  6. //
  7. // See "LnsEfcts.txt" for more information.
  8. //
  9. // *******************************************************
  10.  
  11. // CHECK CAMERA AND LENS OPTIONS
  12. // *****************************
  13.    #declare _LE_tempver = version #version 3.0
  14.    #ifndef (camera_location)  #declare camera_location  = <0, 0, 0> #end
  15.    #ifndef (camera_sky)       #declare camera_sky       = <0, 1, 0> #end
  16.    #ifndef (camera_look_at)   #declare camera_look_at   = <0, 0, 1> #end
  17.    #ifdef  (camera_direction) #declare _LE_camscale     = 1 / vlength(camera_direction * <1, 1, 1>)
  18.       #else #ifdef (camera_angle) #declare _LE_camscale = tan(radians(camera_angle) / 2) * 1.5
  19.          #else #declare _LE_camscale = 1 #end #end
  20.    #ifndef (lens_scale) #declare lens_scale = 1 #end
  21.    #ifndef (layer_separation) #declare layer_separation = 1 #end
  22.  
  23. // CHECK EFFECT OPTIONS
  24. // ********************
  25.    #ifndef (effect_location) #declare effect_location = <0, 0, 1> #end
  26.    #ifndef (effect_colour)
  27.       #ifdef (effect_color) #declare effect_colour = effect_color
  28.          #else #declare effect_colour = <1, 1, 1> #end #end
  29.    #ifndef (source_colour)
  30.       #ifdef (source_color) #declare source_colour = source_color
  31.          #else #declare source_colour = <1, 1, 1> #end #end
  32.    #ifndef (effect_scale) #declare _LE_scale = <1, 1, 1>
  33.       #else #declare _LE_scale = effect_scale * <1, 1, 1> #end
  34.    #ifndef (effect_rotate)        #declare effect_rotate        = 0    #end
  35.    #ifndef (effect_brightness)    #declare effect_brightness    = 1    #end
  36.    #ifndef (effect_intensity)     #declare effect_intensity     = 1    #end
  37.    #ifndef (effect_always_on_top) #declare effect_always_on_top = true #end
  38.  
  39.    #ifndef (glow_type)          #declare glow_type          = 0     #end
  40.    #ifndef (rays_type)          #declare rays_type          = 0     #end
  41.    #ifndef (streak_type)        #declare streak_type        = 0     #end
  42.    #ifndef (spots_type)         #declare spots_type         = 0     #end
  43.    #ifndef (custom_effect_file) #declare custom_effect_file = ""    #end
  44.  
  45.    #ifndef (debug_options) #declare debug_options = false #end
  46.  
  47. // CHECK ANIMATION OPTIONS
  48. // ***********************
  49.    #ifndef (effect_shrink)        #declare effect_shrink        = false #end
  50.    #ifndef (effect_falloff)       #declare effect_falloff       = 60    #end
  51.    #ifndef (effect_falloff_power) #declare effect_falloff_power = 1     #end
  52.    #ifndef (effect_spin)          #declare effect_spin          = 0     #end
  53.    #ifndef (effect_jitter)        #declare effect_jitter        = 0     #end
  54.    #ifndef (effect_flicker)       #declare effect_flicker       = 0     #end
  55.    #ifndef (effect_anim_seed)     #declare effect_anim_seed     = 0     #end
  56.  
  57. // CAMERA CALCULATIONS
  58. // *******************
  59.    #declare _LE_camskyangle    = <degrees(acos(camera_sky.y / vlength(camera_sky))), degrees(atan2(camera_sky.x, camera_sky.z)), 0>
  60.    #declare _LE_camtolook      = (camera_look_at * <1, 1, 1>) - (camera_location * <1, 1, 1>)
  61.    #declare _LE_camtolook      = vrotate (vrotate (_LE_camtolook, -y * _LE_camskyangle.y), -x * _LE_camskyangle.x)
  62.    #declare _LE_camtolookangle = <-degrees(asin(_LE_camtolook.y / vlength(_LE_camtolook))), degrees(atan2(_LE_camtolook.x, _LE_camtolook.z)), 0>
  63.  
  64. // EFFECT CALCULATIONS
  65. // *******************
  66.    #declare _LE_camtoeffect   = (effect_location * <1, 1, 1>) - (camera_location * <1, 1, 1>)
  67.    #declare _LE_camtoeffect   = vrotate (vrotate (_LE_camtoeffect, -y * _LE_camskyangle.y), -x * _LE_camskyangle.x)
  68.    #declare _LE_effectdist    = vlength(_LE_camtoeffect)
  69.    #declare _LE_releffectloc  = vrotate (vrotate (_LE_camtoeffect, -y * _LE_camtolookangle.y), -x * _LE_camtolookangle.x)
  70.    #declare _LE_degfromcentre = degrees(acos(_LE_releffectloc.z / vlength(_LE_releffectloc)))
  71.    #declare _LE_angletohoriz  = degrees(atan2(_LE_releffectloc.y, _LE_releffectloc.x))
  72.    
  73. // ANIMATION CALCULATIONS
  74. // **********************
  75.    #if (effect_falloff > 90) #warning "effect_falloff must be less than 90 degrees!\r\n" #declare effect_falloff = 90 #end
  76.    #if (_LE_degfromcentre >= effect_falloff) #declare _LE_intensity = 0
  77.       #else #declare _LE_intensity = pow(1 - (_LE_degfromcentre / effect_falloff), 1 / effect_falloff_power) #end
  78.    #declare _LE_intensity = _LE_intensity * effect_intensity
  79.    #if (_LE_intensity = 0) #warning "Lens effect is transparent.  No effect created.\r\n"
  80.       #else #if (glow_type + rays_type + streak_type + spots_type + strlen(custom_effect_file) = 0)
  81.          #warning "You have not specified any lens effect components to use!\r\n" #else
  82.  
  83.    #ifndef (_LE_animseed) #declare _LE_animseed = seed(effect_anim_seed + (clock * 1e5)) #end
  84.    #declare _LE_colour    = vnormalize (effect_colour * <1, 1, 1>) * sqrt(3) * effect_brightness
  85.    #declare _LE_colour    = _LE_colour * (1 + ((rand(_LE_animseed) - .5) * effect_flicker))
  86.    #declare _LE_intensity = _LE_intensity * (1 + ((rand(_LE_animseed) - .5) * effect_flicker))
  87.    #declare _LE_scale     = _LE_scale * (1 + ((rand(_LE_animseed) - .5) * effect_flicker))
  88.    #if (effect_shrink != false) #declare _LE_scale = _LE_scale / _LE_effectdist
  89.       #else #declare _LE_scale = _LE_scale * <_LE_camscale, _LE_camscale, 1> #end
  90.    #declare _LE_translate = _LE_releffectloc * (1 / _LE_releffectloc.z)
  91.    #declare _LE_translate = _LE_translate + (<rand(_LE_animseed) - .5, rand(_LE_animseed) - .5, 0> * effect_jitter * .2)
  92.    #declare _LE_rotate    = effect_rotate - (clock * 360 * effect_spin)
  93.  
  94. // LENS CALCULATIONS
  95. // *****************
  96.    #declare _LE_baseobj  = disc {0, z, .999 finish {ambient 1 diffuse 0 reflection 0 refraction 0 phong 0 specular 0 crand 0}}
  97.    #declare _LE_layersep = layer_separation * 1e-3
  98.  
  99.    #if (effect_always_on_top != false)
  100.       #ifndef (_LE_lensoffset) #declare _LE_lensoffset = lens_scale * 1e-2 #end
  101.       #declare _LE_lensscale = _LE_lensoffset
  102.    #else
  103.       #ifndef (_LE_prevdist) #declare _LE_lensscale = _LE_effectdist
  104.          #else #if (_LE_releffectloc.z = _LE_prevdist)
  105.             #declare _LE_lensscale = _LE_effectdist + _LE_prevlayer
  106.                #else #declare _LE_lensscale = _LE_effectdist
  107.    #end #end #end
  108.  
  109. // CREATE LENS EFFECT
  110. // ******************
  111.    union {
  112.    #if (debug_options != false)
  113.       #debug "// LENS EFFECTS INCLUDE FILE OPTIONS\r\n"
  114.       #debug concat("   #declare effect_colour = <", str(effect_colour.x, 0, 3), ", ", str(effect_colour.y, 0, 3), ", ", str(effect_colour.z, 0, 3), ">\r\n")
  115.       #debug concat("   #declare source_colour = <", str(source_colour.x, 0, 3), ", ", str(source_colour.y, 0, 3), ", ", str(source_colour.z, 0, 3), ">\r\n")
  116.       #ifdef (effect_scale) #debug concat("   #declare effect_scale = <", str((effect_scale * <1, 1, 1>).x, 0, 3), ", ", str((effect_scale * <1, 1, 1>).y, 0, 3), ", ", str((effect_scale * <1, 1, 1>).z, 0, 3), ">\r\n") #end
  117.       #debug concat("   #declare effect_rotate = ", str(effect_rotate, 0, 3), "\r\n")
  118.       #debug concat("   #declare effect_brightness = ", str(effect_brightness, 0, 3), "\r\n")
  119.       #debug concat("   #declare effect_intensity = ", str(effect_intensity, 0, 3), "\r\n")
  120.       #debug "   #declare effect_always_on_top = " #if (effect_always_on_top = false) #debug "false" #else #debug "true" #end #debug "\r\n"
  121.    #end
  122.  
  123. // GLOW OPTIONS
  124. // ************
  125.    #ifndef (glow_colour)
  126.       #ifdef (glow_color) #declare glow_colour = glow_color
  127.          #else #declare glow_colour = <1, 1, 1> #end #end
  128.    #ifndef (glow_scale) #declare _LE_glowscale = _LE_scale
  129.       #else #declare _LE_glowscale = glow_scale * _LE_scale #end
  130.    #ifndef (glow_rotate) #declare glow_rotate = 0 #end
  131.    #declare _LE_srotate = z * (_LE_rotate + glow_rotate)
  132.    #ifndef (glow_intensity) #declare _LE_glowint = _LE_intensity
  133.       #else #declare _LE_glowint = _LE_intensity * glow_intensity #end
  134.  
  135.    #if (debug_options != false) #debug "\r\n"
  136.       #debug concat("   #declare glow_type = ", str(glow_type, 0, 0), "\r\n")
  137.       #debug concat("   #declare glow_colour = <", str(glow_colour.x, 0, 3), ", ", str(glow_colour.y, 0, 3), ", ", str(glow_colour.z, 0, 3), ">\r\n")
  138.       #debug concat("   #declare glow_rotate = ", str(glow_rotate, 0, 3), "\r\n")
  139.       #ifdef (glow_scale) #debug concat("   #declare glow_scale = <", str((glow_scale * <1, 1, 1>).x, 0, 3), ", ", str((glow_scale * <1, 1, 1>).y, 0, 3), ", ", str((glow_scale * <1, 1, 1>).z, 0, 3), ">\r\n") #end
  140.       #debug concat("   #declare glow_intensity = ", str(glow_intensity, 0, 3), "\r\n")
  141.    #end
  142.  
  143. // CREATE GLOW
  144. // ***********
  145.    #switch (glow_type) #case (0) #break
  146.  
  147.       #case (1) object {_LE_baseobj pigment {onion color_map {
  148.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  149.             [1 rgb _LE_colour * glow_colour transmit 1]}
  150.             scallop_wave scale 2}
  151.          scale .3 * _LE_glowscale rotate _LE_srotate
  152.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  153.          } #break
  154.  
  155.       #case (2) object {_LE_baseobj pigment {onion colour_map {
  156.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  157.             [.3 rgb <1.1, 1, .8> * _LE_colour * glow_colour transmit pow(.3, _LE_glowint)]
  158.             [1 rgb <1.1, .8, .8> * _LE_colour * glow_colour transmit 1]}
  159.             scallop_wave scale 2}
  160.          scale .3 * _LE_glowscale rotate _LE_srotate
  161.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  162.          } #break
  163.  
  164.       #case (3) object {_LE_baseobj pigment {onion color_map {
  165.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  166.             [.45 rgb <.8, 1, 1.1> * _LE_colour * glow_colour transmit pow(.6, _LE_glowint)]
  167.             [.46 rgb <.8, 1, 1.1> * _LE_colour * glow_colour transmit pow(.5, _LE_glowint)]
  168.             [.47 rgb <.9, 1, 1.1> * _LE_colour * glow_colour transmit pow(.6, _LE_glowint)]
  169.             [1 rgb <.9, 1, 1.1> * _LE_colour * glow_colour transmit 1]}
  170.             scallop_wave scale 2}
  171.          scale .3 * _LE_glowscale rotate _LE_srotate
  172.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  173.          } #break
  174.  
  175.       #case (4) object {_LE_baseobj pigment {onion colour_map {
  176.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  177.             [.41 rgb <1, .9, .9> * _LE_colour * glow_colour transmit pow(.6, _LE_glowint)]
  178.             [.44 rgb <1.1, .8, .8> * _LE_colour * glow_colour transmit pow(.5, _LE_glowint)]
  179.             [.46 rgb <1.1, .8, .8> * _LE_colour * glow_colour transmit pow(.5, _LE_glowint)]
  180.             [.49 rgb <1, .9, .9> * _LE_colour * glow_colour transmit pow(.7, _LE_glowint)]
  181.             [1 rgb _LE_colour * glow_colour transmit 1]}
  182.             scallop_wave scale 2}
  183.          scale .3 * _LE_glowscale rotate _LE_srotate
  184.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  185.          } #break
  186.  
  187.       #case (5) object {_LE_baseobj pigment {onion color_map {
  188.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  189.             [.85 rgb _LE_colour * glow_colour transmit 1]
  190.             [.9 rgb _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  191.             [.92 rgb _LE_colour * glow_colour * 1.2 transmit pow(.8, _LE_glowint)]
  192.             [.95 rgb _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  193.             [1 rgb _LE_colour * glow_colour transmit 1]}
  194.             scallop_wave scale 2}
  195.          scale .2 * _LE_glowscale rotate _LE_srotate
  196.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  197.          } #break
  198.  
  199.       #case (6) object {_LE_baseobj pigment {onion color_map {
  200.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  201.             [.8 rgb _LE_colour * glow_colour transmit 1]
  202.             [.85 rgb <1.2, .3, .3> * _LE_colour * glow_colour transmit 1]
  203.             [.91 rgb <1.2, .3, .3> * _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  204.             [.94 rgb <1.2, 1.2, .3> * _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  205.             [.96 rgb <.3, 1.2, .6> * _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  206.             [.97 rgb <.3, .6, 1.2> * _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  207.             [.98 rgb <1.2, .3, 1.2> * _LE_colour * glow_colour transmit pow(.9, _LE_glowint)]
  208.             [1 rgb <1.2, .3, 1.2> * _LE_colour * glow_colour transmit 1]}
  209.             scallop_wave scale 2}
  210.          scale .2 * _LE_glowscale rotate _LE_srotate
  211.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  212.          } #break
  213.  
  214.       #case (7) object {_LE_baseobj pigment {onion pigment_map {
  215.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  216.             [.4 radial color_map {
  217.                [0 rgb <1.1, 1.1, .4> * _LE_colour * glow_colour transmit pow(.4, _LE_glowint)]
  218.                [1/3 rgb <.4, 1.1, 1.1> * _LE_colour * glow_colour transmit pow(.4, _LE_glowint)]
  219.                [2/3 rgb <1.1, .4, 1.1> * _LE_colour * glow_colour transmit pow(.4, _LE_glowint)]
  220.                [1 rgb <1.1, 1.1, .4> * _LE_colour * glow_colour transmit pow(.4, _LE_glowint)]}
  221.                rotate x*90]
  222.             [.8 radial color_map {
  223.                [0 rgb <1.1, 1.1, .4> * _LE_colour * glow_colour transmit pow(.8, _LE_glowint)]
  224.                [1/3 rgb <.4, 1.1, 1.1> * _LE_colour * glow_colour transmit pow(.8, _LE_glowint)]
  225.                [2/3 rgb <1.1, .4, 1.1> * _LE_colour * glow_colour transmit pow(.8, _LE_glowint)]
  226.                [1 rgb <1.1, 1.1, .4> * _LE_colour * glow_colour transmit pow(.8, _LE_glowint)]}
  227.                rotate x*90]
  228.             [1 rgb _LE_colour * glow_colour transmit 1]}
  229.             scallop_wave scale 2}
  230.          scale .3 * _LE_glowscale rotate _LE_srotate
  231.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  232.          } #break
  233.  
  234.       #case (8) object {_LE_baseobj pigment {onion pigment_map {
  235.             [0 rgb 1.2 * source_colour transmit pow(.1, _LE_glowint)]
  236.             [.4 radial color_map {
  237.                [0 rgb 1.1 * _LE_colour * glow_colour transmit pow(.4, _LE_glowint)]
  238.                [1 rgb <1, 1, 1.1> * _LE_colour * glow_colour transmit pow(.4, _LE_glowint)]}
  239.                sine_wave frequency 7 rotate x * 90]
  240.             [1 rgb <1, .7, 1.2> * _LE_colour * glow_colour transmit 1]}
  241.             scallop_wave scale 2}
  242.          scale .3 * _LE_glowscale rotate _LE_srotate
  243.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  244.          } #break
  245.  
  246.       #else
  247.          #warning "Invalid glow_type specified.  No glow created.\r\n"
  248.       #end
  249.  
  250. // RAY OPTIONS
  251. // ***********
  252.    #ifndef (rays_seed) #declare rays_seed = 0 #end
  253.    #ifndef (rays_flicker) #declare rays_flicker = false #end
  254.    #if (rays_flicker = false) #declare _LE_raysrand = seed(rays_seed)
  255.       #else #declare _LE_raysrand = seed(rays_seed + clock * 1e5) #end
  256.    #ifndef (rays_colour)
  257.       #ifdef (rays_color) #declare rays_colour = rays_color
  258.          #else #declare rays_colour = <1, 1, 1> #end #end
  259.    #ifndef (rays_scale) #declare _LE_raysscale = _LE_scale
  260.       #else #declare _LE_raysscale = rays_scale * _LE_scale #end
  261.    #ifndef (rays_rotate) #declare rays_rotate = 0 #end
  262.    #declare _LE_srotate = z * (_LE_rotate + rays_rotate)
  263.    #ifndef (rays_intensity) #declare _LE_raysint = _LE_intensity
  264.       #else #declare _LE_raysint = _LE_intensity * rays_intensity #end
  265.    #ifndef (rays_frequency) #declare rays_frequency = 1 #end
  266.    #if (rays_frequency <= 0) #warning "rays_frequency must be larger than 0!\r\n" #declare rays_frequency = 1 #end
  267.  
  268.    #if (debug_options != false) #debug "\r\n"
  269.       #debug concat("   #declare rays_type = ", str(rays_type, 0, 0), "\r\n")
  270.       #debug concat("   #declare rays_colour = <", str(rays_colour.x, 0, 3), ", ", str(rays_colour.y, 0, 3), ", ", str(rays_colour.z, 0, 3), ">\r\n")
  271.       #debug concat("   #declare rays_rotate = ", str(rays_rotate, 0, 3), "\r\n")
  272.       #ifdef (rays_scale) #debug concat("   #declare rays_scale = <", str((rays_scale * <1, 1, 1>).x, 0, 3), ", ", str((rays_scale * <1, 1, 1>).y, 0, 3), ", ", str((rays_scale * <1, 1, 1>).z, 0, 3), ">\r\n") #end
  273.       #debug concat("   #declare rays_intensity = ", str(rays_intensity, 0, 3), "\r\n")
  274.       #debug concat("   #declare rays_seed = ", str(rays_seed, 0, 0), "\r\n")
  275.       #debug concat("   #declare rays_frequency = ", str(rays_frequency, 0, 3), "\r\n")
  276.    #end
  277.  
  278. // CREATE RAYS
  279. // ***********
  280.    #switch (rays_type) #case (0) #break
  281.  
  282.       #case (1) #declare _LE_tmpvar = rand(_LE_raysrand) * 3 #while (_LE_tmpvar < 360)
  283.          object {_LE_baseobj pigment {onion color_map {
  284.                [0 rgb rays_colour transmit pow(.95, _LE_raysint)]
  285.                [1 rgb rays_colour transmit 1]}}
  286.             translate y
  287.             scale <.04, 1, 1> * (1 + (<rand(_LE_raysrand), rand(_LE_raysrand), 1> - .5) * 2)
  288.             rotate z * _LE_tmpvar scale .1 * _LE_raysscale rotate _LE_srotate
  289.             translate _LE_translate scale _LE_lensscale}
  290.          #declare _LE_tmpvar = _LE_tmpvar + (4 / rays_frequency) #end
  291.          #declare _LE_lensscale = _LE_lensscale + _LE_layersep #break
  292.  
  293.       #case (2) #declare _LE_tmpvar = rand(_LE_raysrand) * 10 #while (_LE_tmpvar < 360)
  294.          object {_LE_baseobj pigment {onion color_map {
  295.                [0 rgb rays_colour transmit pow(.8 + rand(_LE_raysrand) * .1, _LE_raysint)]
  296.                [1 rgb _LE_colour * rays_colour transmit 1]}          
  297.                scallop_wave scale 2}
  298.             translate y scale <.06, 1, 1> * (1 + (rand(_LE_raysrand) - .5) * .6)
  299.             rotate z * _LE_tmpvar scale .15 * _LE_raysscale
  300.             rotate _LE_srotate translate _LE_translate scale _LE_lensscale}
  301.          #declare _LE_tmpvar = _LE_tmpvar + ((20 + rand(_LE_raysrand) * 10) / rays_frequency) #end
  302.          #declare _LE_lensscale = _LE_lensscale + _LE_layersep #break
  303.  
  304.       #case (3) #declare _LE_tmpvar = rand(_LE_raysrand) * 10 #while (_LE_tmpvar < 360)
  305.          object {_LE_baseobj pigment {onion color_map {
  306.                [0 rgb rays_colour transmit pow(.95, _LE_raysint)]
  307.                [1 rgb rays_colour transmit 1]}}
  308.             translate y * 1.1 scale <.1, 1, 1> * (1 + (rand(_LE_raysrand) - .5) * .7)
  309.             rotate z * _LE_tmpvar scale .12 * _LE_raysscale
  310.             rotate _LE_srotate translate _LE_translate scale _LE_lensscale}
  311.          #declare _LE_tmpvar = _LE_tmpvar + (18 / rays_frequency) #end
  312.          #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  313.       #declare _LE_tmpvar = rand(_LE_raysrand) * 20 #while (_LE_tmpvar < 360)
  314.          object {_LE_baseobj pigment {onion color_map {
  315.                [0 rgb rays_colour transmit pow(.95, _LE_raysint)]
  316.                [1 rgb rays_colour transmit 1]}}
  317.             translate y * 1.1 scale <.15, 1, 1> * (1 + (rand(_LE_raysrand) - .5) * .7)
  318.             rotate z * _LE_tmpvar scale .12 * _LE_raysscale
  319.             rotate _LE_srotate translate _LE_translate scale _LE_lensscale}
  320.          #declare _LE_tmpvar = _LE_tmpvar + (24 / rays_frequency) #end
  321.          #declare _LE_lensscale = _LE_lensscale + _LE_layersep #break
  322.  
  323.       #case (4) #declare _LE_tmpvar = rand(_LE_raysrand) * 30 #while (_LE_tmpvar < 180)
  324.          object {_LE_baseobj pigment {onion color_map {
  325.                [0 rgb source_colour * rays_colour transmit pow(.8, _LE_raysint)]
  326.                [1 rgb _LE_colour * rays_colour transmit 1]}
  327.                scallop_wave scale 2}
  328.             scale <.2, 1, 1> * (1 + (rand(_LE_raysrand) - .5) * .3)
  329.             rotate z * _LE_tmpvar scale .35 * _LE_raysscale rotate _LE_srotate
  330.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  331.             } #declare _LE_tmpvar = _LE_tmpvar + (36 / rays_frequency) #end
  332.          #break
  333.  
  334.       #case (5) #declare _LE_tmpvar = rand(_LE_raysrand) * 5 #while (_LE_tmpvar < 360)
  335.          object {_LE_baseobj pigment {onion pigment_map {
  336.                [0 rgb _LE_colour * rays_colour * (.3 + <rand(_LE_raysrand), rand(_LE_raysrand), rand(_LE_raysrand)>)
  337.                   transmit pow(.8 + rand(_LE_raysrand) * .15, _LE_raysint)]
  338.                [1 rgb _LE_colour * rays_colour transmit 1]}
  339.                scallop_wave scale 2}
  340.             translate y scale <.03, 1, 1> * (1 + (rand(_LE_raysrand) - .5) * .7)
  341.             rotate z * _LE_tmpvar scale .13 * _LE_raysscale
  342.             rotate _LE_srotate translate _LE_translate scale _LE_lensscale}
  343.          #declare _LE_tmpvar = _LE_tmpvar + (6 / rays_frequency) #end
  344.          #declare _LE_lensscale = _LE_lensscale + _LE_layersep #break
  345.  
  346.       #case (6) object {_LE_baseobj pigment {onion pigment_map {
  347.             [0 radial color_map {
  348.                [0 rgb rays_colour transmit pow(.8 _LE_raysint)]
  349.                [.8 rgb _LE_colour * rays_colour transmit 1]}
  350.                sine_wave frequency int(9 * rays_frequency) rotate <90, 0, rand(_LE_raysrand) * 360>]
  351.             [1 rgb _LE_colour * rays_colour transmit 1]}
  352.             scallop_wave scale 2}
  353.          scale .3 * _LE_raysscale rotate _LE_srotate
  354.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  355.          } #break
  356.  
  357.       #case (7) object {_LE_baseobj pigment {onion pigment_map {
  358.             [.2 radial color_map {
  359.                [0 rgb rays_colour transmit pow(.75, _LE_raysint)]
  360.                [.4 rgb _LE_colour * rays_colour transmit 1]
  361.                [.6 rgb rays_colour transmit pow(.95, _LE_raysint)]
  362.                [.8 rgb _LE_colour * rays_colour transmit 1]
  363.                [1 rgb rays_colour transmit pow(.85, _LE_raysint)]}
  364.                triangle_wave frequency int(9 * rays_frequency) rotate <90, 0, rand(_LE_raysrand) * 360>]
  365.             [1 rgb _LE_colour * rays_colour transmit 1]}
  366.             scallop_wave scale 2}
  367.          scale .3 * _LE_raysscale rotate _LE_srotate
  368.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  369.          } #break
  370.  
  371.       #case (8) object {_LE_baseobj pigment {onion pigment_map {
  372.             [.5 radial color_map {
  373.                [0 rgb rays_colour transmit pow(.9, _LE_raysint)]
  374.                [1 rgb _LE_colour * rays_colour transmit 1]}
  375.                triangle_wave frequency int((100 + rand(_LE_raysrand) * 20) * rays_frequency)
  376.                rotate <90, 0, rand(_LE_raysrand) * 360>]
  377.             [1 rgb _LE_colour * rays_colour transmit 1]}
  378.             scallop_wave scale 2}
  379.          scale .3 * _LE_raysscale rotate _LE_srotate
  380.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  381.          } #break
  382.  
  383.       #else
  384.          #warning "Invalid rays_type specified.  No rays created.\r\n"
  385.       #end
  386.  
  387. // STREAK OPTIONS
  388. // **************
  389.    #ifndef (streak_seed) #declare _LE_streakrand = seed(0)
  390.       #else #declare _LE_streakrand = seed(streak_seed) #end
  391.    #ifndef (streak_colour)
  392.       #ifdef (streak_color) #declare streak_colour = streak_color
  393.          #else #declare streak_colour = <1, 1, 1> #end #end
  394.    #ifndef (streak_scale) #declare _LE_streakscale = <1, 1, 1>
  395.       #else #declare _LE_streakscale = streak_scale * <1, 1, 1> #end
  396.       #declare _LE_streakscale = _LE_streakscale * _LE_scale
  397.    #ifndef (streak_rotate) #declare streak_rotate = 0 #end
  398.    #ifndef (streak_intensity) #declare _LE_streakint = _LE_intensity
  399.       #else #declare _LE_streakint = _LE_intensity * streak_intensity #end
  400.    #ifndef (streak_to_centre)
  401.       #ifdef (streak_to_center) #declare streak_to_centre = streak_to_center
  402.          #else #declare streak_to_centre = false #end #end
  403.    #if (streak_to_centre = false) #declare _LE_srotate = z * (_LE_rotate + streak_rotate)
  404.       #else #declare _LE_srotate = z * (_LE_angletohoriz + streak_rotate) #end
  405.  
  406.    #if (debug_options != false) #debug "\r\n"
  407.       #debug concat("   #declare streak_type = ", str(streak_type, 0, 0), "\r\n")
  408.       #debug concat("   #declare streak_colour = <", str(streak_colour.x, 0, 3), ", ", str(streak_colour.y, 0, 3), ", ", str(streak_colour.z, 0, 3), ">\r\n")
  409.       #debug concat("   #declare streak_rotate = ", str(streak_rotate, 0, 3), "\r\n")
  410.       #ifdef (streak_scale) #debug concat("   #declare streak_scale = <", str((streak_scale * <1, 1, 1>).x, 0, 3), ", ", str((streak_scale * <1, 1, 1>).y, 0, 3), ", ", str((streak_scale * <1, 1, 1>).z, 0, 3), ">\r\n") #end
  411.       #debug concat("   #declare streak_intensity = ", str(streak_intensity, 0, 3), "\r\n")
  412.       #debug concat("   #declare streak_seed = ", str(streak_seed, 0, 0), "\r\n")
  413.       #debug "   #declare streak_to_centre = " #if (streak_to_centre = false) #debug "false" #else #debug "true" #end #debug "\r\n"
  414.    #end
  415.  
  416. // CREATE STREAK
  417. // *************
  418.    #switch (streak_type) #case (0) #break
  419.  
  420.       #case (1) object {_LE_baseobj pigment {onion color_map {
  421.             [.4 rgb 1.1 * source_colour * streak_colour transmit pow(.7, _LE_streakint)]
  422.             [1 rgb _LE_colour * streak_colour transmit 1]}
  423.             scallop_wave scale 2}
  424.          scale <.5, .04, 1> rotate z * -45
  425.          scale _LE_streakscale rotate _LE_srotate
  426.          translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  427.          } #break
  428.  
  429.       #case (2) #declare _LE_tmpobj = object {_LE_baseobj
  430.          pigment {onion color_map {
  431.             [0 rgb 1.1 * source_colour * streak_colour transmit pow(.1, _LE_streakint)]
  432.             [1 rgb _LE_colour * streak_colour transmit 1]}
  433.             scallop_wave scale 2} scale <.01, .4, 1>}
  434.          object {_LE_tmpobj scale _LE_streakscale rotate _LE_srotate
  435.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  436.          object {_LE_tmpobj scale 1.2 rotate z * -7
  437.             scale _LE_streakscale rotate _LE_srotate
  438.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  439.          #break
  440.  
  441.       #case (3) #declare _LE_tmpobj = object {_LE_baseobj
  442.          pigment {onion color_map {
  443.             [.1 rgb 1.1 * source_colour * streak_colour transmit pow(.1, _LE_streakint)]
  444.             [1 rgb _LE_colour * streak_colour transmit 1]}
  445.             scallop_wave scale 2} translate y * .3 scale <.02, .35, 1>}
  446.          object {_LE_tmpobj
  447.             rotate z * ((rand(_LE_streakrand) - .5) * 60)
  448.             scale _LE_streakscale rotate _LE_srotate
  449.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  450.          object {_LE_tmpobj
  451.             rotate z * (120 + (rand(_LE_streakrand) - .5) * 60)
  452.             scale _LE_streakscale rotate _LE_srotate
  453.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  454.          object {_LE_tmpobj
  455.             rotate z * (240 + (rand(_LE_streakrand) - .5) * 60)
  456.             scale _LE_streakscale rotate _LE_srotate
  457.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  458.          #break
  459.  
  460.       #case (4) #declare _LE_tmpobj = object {_LE_baseobj
  461.          pigment {onion color_map {
  462.             [.4 rgb source_colour * streak_colour transmit pow(.4, _LE_streakint)]
  463.             [1 rgb _LE_colour * streak_colour transmit 1]}
  464.             scallop_wave scale 2} scale <.5, .02, 1>}
  465.          object {_LE_tmpobj rotate z * 45
  466.             scale _LE_streakscale rotate _LE_srotate
  467.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  468.          object {_LE_tmpobj rotate z * -45
  469.             scale _LE_streakscale rotate _LE_srotate
  470.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  471.          #break
  472.  
  473.       #case (5) #declare _LE_tmpvar = 0 #while (_LE_tmpvar < 360)
  474.          object {_LE_baseobj pigment {onion color_map {
  475.             [0 rgb 1.1 * source_colour * streak_colour transmit pow(.1, _LE_streakint)]
  476.             [1 rgb _LE_colour * streak_colour transmit 1]}
  477.             scallop_wave scale 2}
  478.             translate y * .2 scale <.02, .35, 1> rotate z * _LE_tmpvar
  479.             scale _LE_streakscale rotate _LE_srotate
  480.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  481.          #declare _LE_tmpvar = _LE_tmpvar + 72 #end
  482.          #break
  483.  
  484.       #case (6) #declare _LE_tmpvar = 0 #while (_LE_tmpvar < 360)
  485.          object {_LE_baseobj pigment {onion color_map {
  486.             [0 rgb 1.1 * source_colour * streak_colour transmit pow(.1, _LE_streakint)]
  487.             [1 rgb _LE_colour * streak_colour transmit 1]}
  488.             scallop_wave scale 2}
  489.             scale <.02, .45, 1> rotate z * _LE_tmpvar
  490.             scale _LE_streakscale rotate _LE_srotate
  491.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  492.          #declare _LE_tmpvar = _LE_tmpvar + 120 #end #break
  493.  
  494.       #case (7) object {_LE_baseobj pigment {onion color_map {
  495.                [0 rgb source_colour * streak_colour transmit pow(.3, _LE_streakint)]
  496.                [1 rgb _LE_colour * streak_colour transmit 1]}
  497.                scallop_wave scale 2}
  498.             scale <1.3, .04, 1> * _LE_streakscale rotate _LE_srotate
  499.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  500.          #break
  501.  
  502.       #case (8) #declare _LE_tmpobj = object {_LE_baseobj
  503.          pigment {onion color_map {
  504.             [0 rgb 1.1 * source_colour * streak_colour transmit pow(.2, _LE_streakint)]
  505.             [1 rgb _LE_colour * streak_colour transmit 1]}
  506.             scallop_wave scale 2}}
  507.          object {_LE_tmpobj scale <.02, .5, 1> * _LE_streakscale rotate _LE_srotate
  508.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  509.          object {_LE_tmpobj scale <.8, .02, 1> * _LE_streakscale rotate _LE_srotate
  510.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  511.          #break
  512.  
  513.       #else
  514.          #warning "Invalid streak_type specified.  No streak created.\r\n"
  515.       #end
  516.  
  517. // SPOT OPTIONS
  518. // ************
  519.    #ifndef (spots_seed) #declare _LE_spotsrand = seed(0)
  520.       #else #declare _LE_spotsrand = seed(spots_seed) #end
  521.    #ifndef (spots_colour)
  522.       #ifdef (spots_color) #declare spots_colour = spots_color
  523.          #else #declare spots_colour = <1, 1, 1> #end #end
  524.    #ifndef (spots_scale) #declare _LE_spotsscale = <1, 1, 1>
  525.       #else #declare _LE_spotsscale = spots_scale * <1, 1, 1> #end
  526.       #declare _LE_spotsscale = _LE_spotsscale * _LE_scale / _LE_camscale
  527.    #ifndef (spots_rotate) #declare spots_rotate = 0 #end
  528.    #ifndef (spots_intensity) #declare _LE_spotsint = _LE_intensity
  529.       #else #declare _LE_spotsint = _LE_intensity * spots_intensity #end
  530.    #ifndef (spots_frequency) #declare spots_frequency = 1 #end
  531.    #if (spots_frequency <= 0) #warning "spots_frequency must be larger than 0!\r\n" #declare spots_frequency = 1 #end
  532.    #ifndef (spots_spacing) #declare spots_spacing = 1 #end
  533.    #ifndef (spots_to_centre)
  534.       #ifdef (spots_to_center) #declare spots_to_centre = spots_to_center
  535.          #else #declare spots_to_centre = true #end #end
  536.    #if (spots_to_centre = false)
  537.       #declare _LE_srotate = z * (_LE_rotate + spots_rotate)
  538.       #declare _LE_sspacing = spots_spacing
  539.    #else
  540.       #declare _LE_srotate = z * (_LE_angletohoriz + spots_rotate)
  541.       #declare _LE_sspacing = spots_spacing * (1 + vlength(_LE_translate * <1, 1, 0>))
  542.    #end
  543.  
  544.    #if (debug_options != false) #debug "\r\n"
  545.       #debug concat("   #declare spots_type = ", str(spots_type, 0, 0), "\r\n")
  546.       #debug concat("   #declare spots_colour = <", str(spots_colour.x, 0, 3), ", ", str(spots_colour.y, 0, 3), ", ", str(spots_colour.z, 0, 3), ">\r\n")
  547.       #debug concat("   #declare spots_rotate = ", str(spots_rotate, 0, 3), "\r\n")
  548.       #ifdef (spots_scale) #debug concat("   #declare spots_scale = <", str((spots_scale * <1, 1, 1>).x, 0, 3), ", ", str((spots_scale * <1, 1, 1>).y, 0, 3), ", ", str((spots_scale * <1, 1, 1>).z, 0, 3), ">\r\n") #end
  549.       #debug concat("   #declare spots_intensity = ", str(spots_intensity, 0, 3), "\r\n")
  550.       #debug concat("   #declare spots_seed = ", str(spots_seed, 0, 0), "\r\n")
  551.       #debug concat("   #declare spots_frequency = ", str(spots_frequency, 0, 3), "\r\n")
  552.       #debug concat("   #declare spots_spacing = ", str(spots_spacing, 0, 3), "\r\n")
  553.       #debug "   #declare spots_to_centre = " #if (spots_to_centre = false) #debug "false" #else #debug "true" #end #debug "\r\n"
  554.       #debug "\r\n\r\n"
  555.    #end
  556.  
  557. // CREATE SPOTS
  558. // ************
  559.    #switch (spots_type) #case (0) #break
  560.  
  561.       #case (1) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  562.          object {_LE_baseobj
  563.             #declare _LE_tmpcol = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .6 + .5) * _LE_colour * spots_colour
  564.             #switch (rand(_LE_spotsrand))
  565.                #range (0, .65) pigment {onion color_map {
  566.                   [0 + rand(_LE_spotsrand) * .5 rgb _LE_tmpcol transmit pow(.8 + rand(_LE_spotsrand) * .2, _LE_spotsint)]
  567.                   [.6 + rand(_LE_spotsrand) * .38 rgb _LE_tmpcol transmit pow(.8 + rand(_LE_spotsrand) * .2, _LE_spotsint)]
  568.                   [1 rgb _LE_tmpcol transmit 1]}}
  569.                   scale _LE_spotsscale * (.02 + rand(_LE_spotsrand) * .1)
  570.                   #break
  571.                #range (.65, .9) pigment {onion color_map {
  572.                   [0 rgb _LE_tmpcol * 1.7 transmit pow(.1, _LE_spotsint)]
  573.                   [1 rgb _LE_tmpcol * 1.5 transmit 1]}
  574.                   scallop_wave scale 2}
  575.                   scale _LE_spotsscale * (.005 + rand(_LE_spotsrand) * .01)
  576.                   #break
  577.                #range (.9, 1)
  578.                   pigment {rgb _LE_tmpcol transmit pow(.95, _LE_spotsint)}
  579.                   scale _LE_spotsscale * (.15 + rand(_LE_spotsrand) * .3)
  580.                #end
  581.             translate x * _LE_tmpvar * _LE_sspacing
  582.             scale _LE_camscale rotate _LE_srotate
  583.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  584.          #declare _LE_tmpvar = _LE_tmpvar + ((.01 + rand(_LE_spotsrand) * .14) / spots_frequency)
  585.          #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  586.          #end #break
  587.  
  588.       #case (2) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  589.          object {_LE_baseobj
  590.             #switch (rand(_LE_spotsrand))
  591.                #range (0, .7) pigment {onion color_map {
  592.                   [0 rgb 1.3 * source_colour * spots_colour transmit pow(.5 + rand(_LE_spotsrand) * .4, _LE_spotsint)]
  593.                   [1 rgb _LE_colour * spots_colour transmit 1]}
  594.                   scallop_wave scale 2}
  595.                   scale _LE_spotsscale * (.05 + rand(_LE_spotsrand) * .1)
  596.                   #break
  597.                #range (.7, 1) pigment {onion color_map {
  598.                   [0 rgb source_colour * spots_colour * 1.2 transmit pow(.1, _LE_spotsint)]
  599.                   [1 rgb _LE_colour * spots_colour transmit 1]}
  600.                   scallop_wave scale 2}
  601.                   scale _LE_spotsscale * (.01 + rand(_LE_spotsrand) * .02)
  602.                #end
  603.             translate x * _LE_tmpvar * _LE_sspacing
  604.             scale _LE_camscale rotate _LE_srotate
  605.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  606.          #declare _LE_tmpvar = _LE_tmpvar + ((.05 + rand(_LE_spotsrand) * .05) / spots_frequency)
  607.          #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  608.          #end #break
  609.  
  610.       #case (3) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  611.          object {_LE_baseobj
  612.             #switch (rand(_LE_spotsrand))
  613.                #range (0, .5)
  614.                   pigment {gradient y triangle_wave translate y/5 pigment_map {
  615.                      [.4 gradient y triangle_wave translate y/5 pigment_map {
  616.                         [.4 gradient y triangle_wave translate y/5 color_map {
  617.                            [.4 rgb source_colour * spots_colour transmit pow(.6 + rand(_LE_spotsrand) * .2, _LE_spotsint)]
  618.                            [.5 rgb _LE_colour * spots_colour transmit 1]} rotate z * 120]
  619.                         [.5 rgbt 1]} rotate z * 120]
  620.                      [.5 rgbt 1]} translate <.05, -.1, 0> scale 3.5}
  621.                   rotate z * 15 scale _LE_spotsscale * abs(_LE_tmpvar) * .12
  622.                   #break
  623.                #range (.5, .8)
  624.                   pigment {onion pigment_map {
  625.                      [.5 radial color_map {
  626.                         [0 rgb <1.2, 1.2, .4> * _LE_colour * spots_colour transmit pow(.8, _LE_spotsint)]
  627.                         [1/3 rgb <.4, 1.2, 1.2> * _LE_colour * spots_colour transmit pow(.8, _LE_spotsint)]
  628.                         [2/3 rgb <1.2, .4, 1.2> * _LE_colour * spots_colour transmit pow(.8, _LE_spotsint)]
  629.                         [1 rgb <1.2, 1.2, .4> * _LE_colour * spots_colour transmit pow(.8, _LE_spotsint)]}
  630.                         rotate x*90]
  631.                      [1 rgb _LE_colour * spots_colour transmit 1]}}
  632.                   rotate z * rand(_LE_spotsrand) * 360
  633.                   scale _LE_spotsscale * (.02 + rand(_LE_spotsrand) * .1)
  634.                   #break
  635.                #range (.8, 1)
  636.                   pigment {onion color_map {
  637.                      [0 rgb 1.3 transmit pow(.1, _LE_spotsint)]
  638.                      [1 rgb _LE_colour * spots_colour * 1.3 transmit 1]}
  639.                      scallop_wave scale 2}
  640.                   scale _LE_spotsscale * (.01 + rand(_LE_spotsrand) * .01)
  641.                #end
  642.             rotate -_LE_srotate
  643.             translate x * _LE_tmpvar * _LE_sspacing
  644.             scale _LE_camscale rotate _LE_srotate
  645.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  646.          #declare _LE_tmpvar = _LE_tmpvar + ((.04 + rand(_LE_spotsrand) * .04) / spots_frequency)
  647.          #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  648.          #end #break
  649.  
  650.       #case (4) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  651.          object {_LE_baseobj
  652.             #declare _LE_tmpcol = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .4 + .7) * _LE_colour * spots_colour
  653.                pigment {gradient x triangle_wave pigment_map {
  654.                   [.4 gradient x triangle_wave color_map {
  655.                      [.4 rgb _LE_tmpcol transmit pow (.8 + rand(_LE_spotsrand) * .1, _LE_spotsint)]
  656.                      [.5 rgb _LE_tmpcol transmit 1]} rotate z * 90]
  657.                   [.5 rgb _LE_tmpcol transmit 1]} scale 3}
  658.                rotate z * 45
  659.                scale <1, .7, 1> * _LE_spotsscale * (abs(_LE_tmpvar) * .15 + rand(_LE_spotsrand) * .02)
  660.                translate x * _LE_tmpvar * _LE_sspacing
  661.                scale _LE_camscale rotate _LE_srotate
  662.                translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  663.             #if (rand(_LE_spotsrand) < .5) object {_LE_baseobj
  664.                pigment {onion color_map {
  665.                   [0 rgb _LE_tmpcol * 1.2 transmit pow(.3, _LE_spotsint)]
  666.                   [1 rgb _LE_tmpcol * 1.1 transmit 1]}
  667.                   scallop_wave scale 2}
  668.                scale _LE_spotsscale * (.005 + rand(_LE_spotsrand) * .01)
  669.                translate x * (_LE_tmpvar + (rand(_LE_spotsrand) - .5) * .1) * _LE_sspacing
  670.                scale _LE_camscale rotate _LE_srotate
  671.                translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  672.             #end
  673.             #declare _LE_tmpvar = _LE_tmpvar + ((.1 + rand(_LE_spotsrand) * .02) / spots_frequency)
  674.             #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  675.          #end #break
  676.  
  677.       #case (5) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  678.          object {_LE_baseobj
  679.             #declare _LE_tmpcol = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .4 + .7) * _LE_colour * spots_colour
  680.             #switch (rand(_LE_spotsrand))
  681.                #range (0, .6) pigment {onion color_map {
  682.                   [0 rgb _LE_tmpcol transmit pow(.9, _LE_spotsint)]
  683.                   [1 rgb _LE_colour * spots_colour transmit 1]}}
  684.                   scale _LE_spotsscale * (.05 + rand(_LE_spotsrand) * .06)
  685.                   #break
  686.                #range (.6, 1) pigment {onion color_map {
  687.                   [.7 rgb _LE_colour * spots_colour transmit 1]
  688.                   [.8 rgb _LE_tmpcol * 1.2 transmit pow(.8 + rand(_LE_spotsrand) * .1, _LE_spotsint)]
  689.                   [1 rgb _LE_colour * spots_colour transmit 1]}}
  690.                   scale _LE_spotsscale * (.05 + rand(_LE_spotsrand) * .08)
  691.                   rotate -_LE_srotate
  692.                #end
  693.             translate x * _LE_tmpvar * _LE_sspacing
  694.             scale _LE_camscale rotate _LE_srotate
  695.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  696.          #declare _LE_tmpvar = _LE_tmpvar + ((.05 + rand(_LE_spotsrand) * .05) / spots_frequency)
  697.          #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  698.          #end #break
  699.              
  700.       #case (6) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  701.          object {_LE_baseobj
  702.             #declare _LE_tmpcol = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .5 + .7) * _LE_colour * spots_colour
  703.             #switch (rand(_LE_spotsrand))
  704.                #range (0, .4) pigment {onion pigment_map {
  705.                      [rand(_LE_spotsrand) * .5 rgb _LE_tmpcol transmit pow(.8 + rand(_LE_spotsrand) * .15, _LE_spotsint)]
  706.                      [1 gradient x triangle_wave pigment_map {
  707.                         [.45 gradient x triangle_wave pigment_map {
  708.                            [.45 gradient x triangle_wave color_map {
  709.                               [.45 rgb _LE_tmpcol transmit pow (.8 + rand(_LE_spotsrand) * .1, _LE_spotsint)]
  710.                               [.5 rgb _LE_tmpcol transmit 1]} rotate z * 120]
  711.                            [.5 rgb _LE_tmpcol transmit 1]} rotate z * 120]
  712.                         [.5 rgb _LE_tmpcol transmit 1]} scale 3]}}
  713.                   scale _LE_spotsscale * (.02 + abs(_LE_tmpvar) * .1)
  714.                   #break
  715.                #range (.4, .7)
  716.                   pigment {onion color_map {
  717.                      [0 + rand(_LE_spotsrand) * .5 rgb _LE_tmpcol transmit pow(.9 + rand(_LE_spotsrand) * .05, _LE_spotsint)]
  718.                      [.6 + rand(_LE_spotsrand) * .38 rgb _LE_tmpcol transmit pow(.9 + rand(_LE_spotsrand) * .05, _LE_spotsint)]
  719.                      [1 rgb _LE_tmpcol transmit 1]}}
  720.                   scale _LE_spotsscale * (.05 + rand(_LE_spotsrand) * .1)
  721.                   #break
  722.                #range (.7, 1)
  723.                   pigment {onion color_map {
  724.                      [0 rgb _LE_tmpcol * 1.7 transmit pow(.1, _LE_spotsint)]
  725.                      [1 rgb _LE_tmpcol * 1.5 transmit 1]}
  726.                      scallop_wave scale 2}
  727.                   scale _LE_spotsscale * (.005 + rand(_LE_spotsrand) * .015)
  728.                #end
  729.             translate x * _LE_tmpvar * _LE_sspacing
  730.             scale _LE_camscale rotate _LE_srotate
  731.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  732.          #declare _LE_tmpvar = _LE_tmpvar + ((.05 + rand(_LE_spotsrand) * .05) / spots_frequency)
  733.          #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  734.          #end #break
  735.  
  736.       #case (7) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  737.          object {_LE_baseobj
  738.             #declare _LE_tmpcol = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .6 + .5) * _LE_colour * spots_colour
  739.                pigment {onion color_map {
  740.                   [.3 rgb _LE_tmpcol * 1.2 transmit pow(.1, _LE_spotsint)]
  741.                   [1 rgb _LE_tmpcol transmit 1]}
  742.                   scallop_wave scale 2}
  743.                scale _LE_spotsscale * (.01 + rand(_LE_spotsrand) * .03)
  744.                translate x * _LE_tmpvar * _LE_sspacing
  745.                scale _LE_camscale rotate _LE_srotate
  746.                translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  747.             #declare _LE_tmpvar = _LE_tmpvar + ((.005 + rand(_LE_spotsrand) * .2) / spots_frequency)
  748.             #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  749.          #end #break
  750.  
  751.       #case (8) #declare _LE_tmpvar = -1 #while (_LE_tmpvar < 1)
  752.          object {_LE_baseobj
  753.             #declare _LE_tmpcol = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .6 + .5) * _LE_colour * spots_colour
  754.             #declare _LE_tmpcol2 = (<rand(_LE_spotsrand), rand(_LE_spotsrand), rand(_LE_spotsrand)> * .7 + .6) * _LE_colour * spots_colour
  755.             #switch (rand(_LE_spotsrand))
  756.                #range (0, .8) pigment {onion color_map {
  757.                   [0 + rand(_LE_spotsrand) * .6 rgb _LE_tmpcol transmit pow(.85 + rand(_LE_spotsrand) * .1, _LE_spotsint)]
  758.                   [.7 + rand(_LE_spotsrand) * .28 rgb _LE_tmpcol2 transmit pow(.8 + rand(_LE_spotsrand) * .15, _LE_spotsint)]
  759.                   [1 rgb _LE_tmpcol transmit 1]}}
  760.                   scale _LE_spotsscale * (.03 + rand(_LE_spotsrand) * .1)
  761.                   #break
  762.                #range (.8, 1) pigment {onion color_map {
  763.                   [0 rgb _LE_tmpcol * 1.7 transmit pow(.1, _LE_spotsint)]
  764.                   [1 rgb _LE_tmpcol * 1.5 transmit 1]}
  765.                   scallop_wave scale 2}
  766.                   scale _LE_spotsscale * (.005 + rand(_LE_spotsrand) * .015)
  767.                #end
  768.             translate x * _LE_tmpvar * _LE_sspacing
  769.             scale _LE_camscale rotate _LE_srotate
  770.             translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep}
  771.          #declare _LE_tmpvar = _LE_tmpvar + ((.005 + rand(_LE_spotsrand) * .1) / spots_frequency)
  772.          #if (_LE_tmpvar > -.15 & _LE_tmpvar < .15) #declare _LE_tmpvar = .15 #end
  773.          #end #break
  774.  
  775.       #else
  776.          #warning "Invalid spots_type specified.  No spots created.\r\n"
  777.       #end
  778.  
  779. // INCLUDE CUSTOM EFFECT FILE
  780. // **************************
  781.    #if (strlen(custom_effect_file) > 0)
  782.       #if (file_exists(custom_effect_file))
  783.          #include custom_effect_file
  784.          #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  785.       #else
  786.          #warning concat("Could not find custom_effect_file \"", custom_effect_file, "\"!\r\n")
  787.       #end
  788.    #end
  789.  
  790. // GET RANDOM SEEDS FOR NEXT EFFECT
  791. // ********************************
  792.    #declare rays_seed = rand(_LE_raysrand) * 1e5
  793.    #declare streak_seed = rand(_LE_streakrand) * 1e5
  794.    #declare spots_seed = rand(_LE_spotsrand) * 1e5
  795.  
  796. // POSITION LENS EFFECT AND CAMERA
  797. // *******************************
  798.    rotate _LE_camtolookangle rotate _LE_camskyangle translate camera_location
  799.    no_shadow hollow}
  800.  
  801.    camera {
  802.       location camera_location
  803.       sky camera_sky
  804.       #ifdef (camera_direction) direction camera_direction #end
  805.       #ifdef (camera_angle) angle camera_angle #end
  806.       look_at camera_look_at}
  807.  
  808. // STORE LAYER OFFSETS FOR SUBSEQUENT EFFECTS
  809. // ******************************************
  810.    #if (effect_always_on_top != false)
  811.       #declare _LE_lensoffset = _LE_lensscale
  812.    #else
  813.       #declare _LE_prevdist = _LE_releffectloc.z
  814.       #declare _LE_prevlayer = _LE_lensscale - _LE_effectdist
  815.    #end
  816.  
  817.    #end #end #version _LE_tempver
  818.